function whatIsInAName(collection, source) {
    // What's in a name?
    var arr = [];
    // 请把你的代码写在这条注释以下
    arr = collection.filter(item => {
        let flag = true;
        if (Object.keys(item).length >= Object.keys(source).length) {
            for (let key in source) {
                if (!item.hasOwnProperty(key) || source[key] !== item[key]) {
                    return false;
                }
            }
        } else {
            return false;
        }
        return true;
    });
    // 请把你的代码写在这条注释以上
    return arr;
}

whatIsInAName(
    [
        { first: "Romeo", last: "Montague" },
        { first: "Mercutio", last: null },
        { first: "Tybalt", last: "Capulet" }
    ],
    { last: "Capulet" }
);
